﻿<!--#include file="h.asp"--><%
'
'	七色虎建站系统
'	文章列表页面
'	2012.4.5

Sub main
	'文章列表配置
	If Not ifNum(numList) Then numList="10"'文章列表数
	
	Dim act,rs,hit,tpl,list,ad2txt,ad3txt,rndtxt,id,body_,classname,sql,PageSize,Count,page,i,pagecount,class_,sqlCount,title
	body_ = ""
	id=getN("id",1)
	act=request.QueryString("act")
	tpl=ubbcode(tplList)
	if act<>"" then
		title = "站内排行榜"
		body_ = body_ & checkMsg()'信息
		if act="top" then
			body_ = body_ & "[div=nav]-"& hu.url("?aid=index","首页") & "-站内排行-" & hu.url("list.asp?act=new","最新") & "[/div]"
		else
			body_ = body_ & "[div=nav]-"& hu.url("?aid=index","首页") & "-站内最新-" & hu.url("list.asp?act=top","排行") & "[/div]"
		end if
	else
		Set rs = hu.conn("select top 1 class from 74hu_list where classid="&id)
		if rs.eof then
			rs.close
			set rs=Nothing
			' hu.redirect ""&http_path&"?aid=index&"&sid_str&""
			rupt "错误", "文章列表已删除!"
		end if
		classname=rs("class")
		rs.close
		set rs=Nothing
		title = classname
		body_ = body_ & checkMsg()'信息
		body_ = body_ & "[div=nav]-"& hu.url("?aid=index", "首页") &"-"&classname&"-" & hu.url("list.asp?act=top","排行") &"[/div]"
	end if
	Call setVisitPage("<a href='"&http_path&"list.asp?id="&id&"&amp;act="&act&"&amp;[sid]'>"&getLeft(title,8)&"</a>")
	if act<>"" then
		if act="top" then
			sql="select top 100 id,title,hit from 74hu_article where classid<>0 order by hit*1000+id desc,id desc"
		else
			sql="select top 100 id,title,hit from 74hu_article where classid<>0 order by id desc"
		end if
	else
		sql="select id,title,hit from 74hu_article where classid="&id&" order by id desc"
	end if
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.open sql, hu.db, 1, 1
	If Not rs.eof then
		count = rs.recordcount
		ad2txt=getAD(2,1)
		PageSize=numList
		page=getN("page",1)
		if page<=0 or page="" then page=1
		pagecount=(count+pagesize-1)\pagesize
		if page>pagecount then page=pagecount
		rs.move(pagesize*(page-1))
		For i=1 To PageSize
			If rs.eof Then Exit For
			If wapHits=1 Then hit="["&rs("hit")&"阅]"
			If (i mod 2)=0 Then
				class_="even"
			Else
				class_="odd"
			End If
			list=list& "[div="&class_&"]" & hu.url("article.asp?id="&rs("id"), i+(page-1)*PageSize&"."&nowml(rs("title"))) & hit &"[/div]"
			rs.moveNext
		Next
		list= list & showPage("list.asp", "act:"&act&",id:"&id, page, pagecount)
		rndtxt=wendtitle(4,id)
		ad3txt=getAD(3,1)
	Else
		list= "暂时没有文章！<br/>"
	end if
	rs.close
	set rs=nothing
	Dim rndnum
	rndnum=time_r'要避免内容中有{}标签,需将{}转义
	tpl=Replace(tpl,"{","{_74hu_"&rndnum)
	tpl=Replace(tpl,"{_74hu_"&rndnum&"ad2}",ad2txt,1,1)
	tpl=Replace(tpl,"{_74hu_"&rndnum&"ad3}",ad3txt,1,1)
	tpl=Replace(tpl,"{_74hu_"&rndnum&"rnd}",rndtxt,1,1)
	tpl=Replace(tpl,"{_74hu_"&rndnum&"list}",list,1,1)
	hu.body = comUbb(body_ & tpl)
	hu.title = title &"-"& wapTitle
End Sub

%>